package cn.itsource.quartz.config;

import org.quartz.*;

import java.text.SimpleDateFormat;
import java.util.Date;

/*
    定义自己的业务方法 逻辑
 */
public class PrintTimeJob implements Job{
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        //获取任务详情里面的数据
        JobDetail jobDetail = jobExecutionContext.getJobDetail();
        JobKey key = jobDetail.getKey();
        System.out.println(key);
        JobDataMap dataMap = jobDetail.getJobDataMap();
        System.out.println(dataMap.get("msg"));

        System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
    }
}
